package com.tangding.net.pool;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.stereotype.Component;

import io.netty.channel.Channel;

/**
 * @description 
 *
 * @author Ranger
 * @version 2017年12月13日_下午2:22:22
 *
 */
@Component
public class NettySessionConcurrentPool extends BaseNettySessionPool {

	@Override
	protected void init() {
		pool = new ConcurrentHashMap<Channel, String>();
	}
	
	@Override
	public Channel getChannel(String uid) {
		Channel c = null;
		for (Map.Entry<Channel, String> entry : pool.entrySet()) {
			if (uid.equals(entry.getValue())) {
				c = entry.getKey();
				break;
			}
		}
		return c;
	}

}
